package com.hsy.raffle.controller;




import com.hsy.raffle.dto.UserDto;
import com.hsy.raffle.service.UserService;
import com.hsy.raffle.vo.R;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * 用户表(User)表控制层
 *
 * @author makejava
 * @since 2023-05-08 16:00:24
 */
@RestController
@CrossOrigin
@Api(tags = "用户模块")
public class UserController {
    /**
     * 服务对象
     */
    @Resource
    private UserService service;

    @GetMapping("/api/user/all")
    public R all() {
        return service.queryall();
    }

    @PostMapping("/api/user/register")
    public R register(@RequestBody UserDto dto) {
        return service.register(dto);
    }

    @PostMapping("/api/user/login")
    public R login(@RequestBody UserDto dto){
        return service.login(dto);
    }

    @GetMapping("/api/user/list")
    public R list(){
        return service.queryRaffle();
    }

}

